package action.actionimp;

import Exception.RegException;
import action.RegAction;
import dao.RegDao;
import dao.daoimp.RegDaoImp;
import entity.User;

public class RegActionImp implements RegAction {
	RegDao reg = new RegDaoImp();
       User user=new User();
	@Override
	public boolean check(String username, String pwd, String ok_pwd,
			String question, String answer) throws RegException {
		if(username==null||"".equals(username)||username.matches("[1-9]\\w{5,}")){
			return false;
		}
		if(pwd==null||"".equals(pwd)||pwd.matches("\\s")){
			return false;
		}
		if(ok_pwd==null||!(ok_pwd.equals(pwd))){
			return false;
		}
		if (question==null||answer==null) {
			return false;
		}
		return reg.Reg(username, pwd, question, answer);
	}
}
